<?php $this->load->view('layout/header'); ?>

<script type="text/javascript">
    //<![CDATA[
    var theForm = document.forms['form1'];
    if (!theForm) {
        theForm = document.form1;
    }
    function __doPostBack(eventTarget, eventArgument) {
        if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
            theForm.__EVENTTARGET.value = eventTarget;
            theForm.__EVENTARGUMENT.value = eventArgument;
            theForm.submit();
        }
    }
    //]]>
</script>
<script type="text/javascript">
    //<![CDATA[
    function WebForm_OnSubmit() {
        if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
        return true;
    }
    //]]>
</script>
<form name="form1" method="post" action="<?php echo b_url('wechat/remsg_action/').$info['weixinMsgReplyID']?>" onsubmit="javascript:return WebForm_OnSubmit();" id="form1">
    <div>
    </div>
    <div id="container">
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_form">
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    消息回复方式：
                </td>
                <td>
                    <input type="radio" name="MsgReplyWay" value="1" <?php if($info['MsgReplyWay']==1){echo 'checked';}?> onclick="sel_type(1)">订阅
                    <input type="radio" name="MsgReplyWay" value="2" <?php if($info['MsgReplyWay']==2){echo 'checked';}?> onclick="sel_type(2)">自动回复
                    <input type="radio" name="MsgReplyWay" value="3" <?php if($info['MsgReplyWay']==3){echo 'checked';}?> onclick="sel_type(3)">菜单Click
                    <!--<input type="radio" name="MsgReplyWay" value="5" <?php /*if($info['MsgReplyWay']==5){echo 'checked';}*/?>>群发消息-->
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    消息类型：
                </td>
                <td>
                    文本消息<input type="hidden" name="MsgType" value="text">
                    <!--<select name="MsgType">
                        <option value="">请选择</option>
                        <option value="text" <?php /*if($info['MsgType']=='text'){echo 'selected';}*/?>>文本消息</option>
                        <option value="pictext" <?php /*if($info['MsgType']=='pictext'){echo 'selected';}*/?>>图文消息</option>
                    </select>-->
                </td>
            </tr>
            <tr class="change_win table_form_row" <?php if($info['MsgReplyWay'] == ''){ ?> style="display:none;"<?php } ?>>
                <?php
                if($info['MsgReplyWay'] == 2){
                    echo '<td style="width: 15%" align="right">回复数字:</td><td><select name="KeyValue">';
                    if($info['KeyValue'] == 'default')
                        echo '<option value="default" selected>默认消息</option>';
                    else
                        echo '<option value="default">默认消息</option>';
                    if($info['KeyValue'] == 1)
                        echo '<option value="1" selected>1</option>';
                    else
                        echo '<option value="1">1</option>';
                    if($info['KeyValue'] == 2)
                        echo '<option value="2" selected>2</option>';
                    else
                        echo '<option value="2">2</option>';
                    if($info['KeyValue'] == 3)
                        echo '<option value="3" selected>3</option>';
                    else
                        echo '<option value="3">3</option>';
                    if($info['KeyValue'] == 4)
                        echo '<option value="4" selected>4</option>';
                    else
                        echo '<option value="4">4</option>';
                    if($info['KeyValue'] == 5)
                        echo '<option value="5" selected>5</option>';
                    else
                        echo '<option value="5">5</option>';
                    if($info['KeyValue'] == 6)
                        echo '<option value="6" selected>6</option>';
                    else
                        echo '<option value="6">6</option></select></td>';
                }elseif($info['MsgReplyWay'] == 3){
                    echo '<td style="width: 15%" align="right">key值:</td><td><input type="text" name="KeyValue" value="'.$info['KeyValue'].'"></td>';
                }?>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    文本消息内容：
                </td>
                <td>
                    <textarea name="TxtContent" style="height: 150px;width: 450px;"><?php echo $info['TxtContent']; ?></textarea>
                </td>
            </tr>
            <tr class="table_form_btn">
                <td align="right">
                    &nbsp;
                </td>
                <td>
                    <input type="submit" value="保存" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;btnSave&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="btnSave" />
                    <input type="button" value="返回" onclick="javascript:history.go(-1);" />
                    <span id="errMsg" style="color:Red;"></span>
                </td>
            </tr>
        </table>
    </div>

    <script type="text/javascript">
        function sel_type(id){
            if(id == 1){
                var str = '';
                $(".change_win").html(str);
                $(".change_win").css('display','none');
            }else if(id == 2){
                var str = '<td style="width: 15%" align="right">回复数字:</td><td><select name="KeyValue">'+
                    '<option value="">请选择</option>'+
                    '<option value="default">默认消息</option>'+
                    '<option value="1">1</option>'+
                    '<option value="2">2</option>'+
                    '<option value="3">3</option>'+
                    '<option value="4">4</option>'+
                    '<option value="5">5</option>'+
                    '<option value="6">6</option>'+
                    '</select></td>';
                $(".change_win").html(str);
                $(".change_win").css('display','');
            }else if(id == 3){
                var str = '<td style="width: 15%" align="right">key值:</td><td><input type="text" name="KeyValue"></td>';
                $(".change_win").html(str);
                $(".change_win").css('display','');
            }
        }
    </script>
    </body>
    </html>